//
//  ProgressBar.m
//  MUBATE
//
//  Created by sunbin on 2017/2/13.
//  Copyright © 2017年 Quanli. All rights reserved.
//

#import "ProgressBar.h"
#import "BarView.h"


@interface ProgressBar()<barDelegate>
@property (strong, nonatomic) BarView *barView;
@property (weak, nonatomic) IBOutlet UIView *BarViewCtl;


@end
@implementation ProgressBar
{
    NSArray *target;
    CGFloat rate;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    [_BarViewCtl addSubview:[self barView]];

}

- (void)progressBarWithTargetAry:(NSArray *)argetAry rate:(CGFloat)rateValue{

    target = argetAry; rate=rateValue;
    
    [_barView reloadData];


}


-(BarView *)barView{
    _barView = [[BarView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, HEIGHT(_BarViewCtl))];
    _barView.delegate = self;
    return _barView;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}
- (IBAction)toDividend:(UIButton *)sender {
    if ([self.delegate respondsToSelector:@selector(cehckDetail)]) {
        [self.delegate cehckDetail];
    }
}



#pragma make -barDelegate



- (NSArray *)barWithTargetAry{
    return target;
}
- (CGFloat )barWithRate{
    return rate;
}
- (UIColor *)completeBarColor{
    return [UIColor yellowColor];
}
- (UIColor *)unCompleteBarColor{
    return [UIColor grayColor];
}
- (barMake)barty{
    return barList;
}















@end
